package com.appchina.autism.express;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import android.widget.Toast;

import com.appchina.autism.widget.ItemView;
import com.umeng.analytics.MobclickAgent;

public class SettingActivity extends Activity implements OnClickListener{
	
	private TextView mTitle;
	private View mActionBarLeft;
	private View mActionBarRight;
	
	private ItemView mMakeItemView;
	private ItemView mAnalyItemView;	
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_setting);
		
		mTitle = (TextView) findViewById(R.id.common_widget_action_bar_title);
		mTitle.setText(R.string.activity_title_setting);
		mActionBarLeft = findViewById(R.id.common_widget_action_bar_left);
		mActionBarLeft.setOnClickListener(this);
		mActionBarRight = findViewById(R.id.common_widget_action_bar_right);
//		mActionBarRight.setOnClickListener(this);
		mActionBarRight.setVisibility(View.INVISIBLE);
		
		mMakeItemView = (ItemView) findViewById(R.id.setting_make);
		mMakeItemView.setContent(R.drawable.setting_make, R.string.make_card);
		mMakeItemView.setOnClickListener(this);
		mAnalyItemView = (ItemView) findViewById(R.id.setting_analy);
		mAnalyItemView.setContent(R.drawable.setting_analy, R.string.analy_card);
		mAnalyItemView.setOnClickListener(this);
	}
	
	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		MobclickAgent.onPause(this);
		super.onResume();
	}
	
	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		MobclickAgent.onPause(this);
		super.onPause();
	}
	
	public static void launch(Context context) {
		Intent intent = new Intent(context, SettingActivity.class);
		context.startActivity(intent);
	}

	@Override
	public void onClick(View v) {
		switch(v.getId()) {
		case R.id.common_widget_action_bar_left:
			SettingActivity.this.finish();
			break;
		case R.id.setting_make:
			showComingSoonToast();
			break;
		case R.id.setting_analy:
			showComingSoonToast();
			break;
		default:
			break;
		}
		
	}
	
	private void showComingSoonToast() {
		Toast.makeText(this, R.string.coming_soon, Toast.LENGTH_SHORT).show();
	}
}
